package org.tomdog.controller;

import lombok.extern.slf4j.Slf4j;
import org.demo.base.mvc.HttpResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试日志
 * @author tomdog
 */
@RestController
@Slf4j
public class LogTestController {

    @GetMapping("/log/test")
    public HttpResult test() {
        log.debug("我是 debug");
        log.info("我是 info");
        log.warn("我是 warn");
        log.error("我是 error");
        System.out.println("我是sout");// 只会打印到控制台，并不会记录日志
        return HttpResult.success();
    }

    @GetMapping("/log/test/{num}")
    public HttpResult testNum(@PathVariable("num") Integer num) {
        int random = 1/num;
        return HttpResult.success(random);
    }
}
